<template>
  <div class="box">
    <div class="clearfix top">
      <p class="title">实时游客统计</p>
      <p class="bg"></p>
      <p class="right">
        可预约总量
        <span>
          {{ people }}
        </span>
        人
      </p>
    </div>

    <div class="number">
      <span v-for="(item, index) in people" :key="index">{{ item }}</span>
    </div>

    <div class="charts" ref="echartsRef"></div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
const people = ref('216908人')

import * as echarts from 'echarts'
import 'echarts-liquidfill'
const echartsRef = ref()
onMounted(() => {
  const myCharts = echarts.init(echartsRef.value)
  myCharts.setOption({
    title: {
      text: '水球图'
    },
    grid: {
      left: 10,
      top: 0,
      right: 10,
      bottom: 0
    },
    xAxis: {},
    yAxis: {},
    series: {
      type: 'liquidFill',
      data: [0.6],
      radius: '90%',
      outline: {
        show: true,
        borderDistance: 0,
        itemStyle: {
          color: 'none',
          borderColor: '#294D99',
          borderWidth: 8,
          shadowBlur: 20,
          shadowColor: 'rgba(0, 0, 0, 0.25)'
        }
      }
    }
  })
})
</script>

<style scoped lang="scss">
.box {
  display: flex;
  flex-direction: column;
  background: #fff;
  background: url(../../images/dataScreen-main-lb.png) no-repeat;
  background-size: 100% 100%;
  overflow: hidden;
  .top {
    padding-top: 10px;
    font-size: 20px;
    margin: 0 20px;
    color: #fff;
    .title {
    }
    .bg {
      margin-top: 10px;
      width: 68px;
      height: 7px;
      background: url(../../images/dataScreen-title.png) no-repeat;
      background-size: 100% 100%;
    }
    .right {
      float: right;
      span {
        padding: 0 6px;
        color: orange;
      }
    }
  }

  .number {
    margin-top: 20px;
    padding: 10px;
    display: flex;

    span {
      flex: 1;
      height: 40px;
      line-height: 40px;
      font-weight: bold;
      text-align: center;
      color: #29fcff;
      background: url(../../images/total.png) no-repeat;
      background-size: 100% 100%;
    }
  }

  .charts {
    width: 100%;
    flex: 1;
  }
}
</style>
